const merge = require('webpack-merge')
// 压缩 JS
const UglifyJSPlugin = require('uglifyjs-webpack-plugin')
// 压缩 css
// const TerserJSPlugin = require('terser-webpack-plugin');
// const MiniCssExtractPlugin = require('mini-css-extract-plugin');
// const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin');
const common = require('./webpack.common.js')
module.exports = merge(common, {
  mode: 'production',
  devtool: 'source-map',
  // optimization 为Weback4.0之后需要优化的内容
  optimization: {
    // 是否开启优化
    minimize: true,
    minimizer: [ // 用于配置 minimizers 和选项
      // new TerserJSPlugin({}),
      // new OptimizeCSSAssetsPlugin({})
      new UglifyJSPlugin({
        sourceMap: true,
        extractComments: false,
        parallel: 4
      })
    ]
  },
  plugins: []
})